package com.freshcity.component.tooltip
{
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	public class LabelToolTip extends Sprite
	{
		private var label:TextField;
		private var _toolTipStr:String;

		public function LabelToolTip(arg1:String="")
		{
			super();
			this._toolTipStr = arg1;
			this.init();
			return;
		}
		
		public function set data(arg1:String):void
		{
			this._toolTipStr = arg1;
			this.init();
			return;
		}
		
		private function init():void
		{
			if (!this.label) 
			{
				this.label = new TextField();
				addChild(this.label);
				var tf:TextFormat = new TextFormat("宋体",12,0);
				tf.leading = 4;
				this.label.defaultTextFormat = tf;
				this.label.autoSize = TextFieldAutoSize.LEFT;
				this.label.multiline = true;
				if(this.label.width>180){
					this.label.wordWrap=true;
					this.label.width=180;
				}
			}
			this.label.text = this._toolTipStr;
		}
		
		public function dispose():void
		{
			while (this.numChildren) 
			{
				removeChildAt(0);
			}
			return;
		}
		
	}
}